import { Component, OnInit, Injector } from '@angular/core';
import { ServiceProxy, ProductInfoDTO } from '@shared/service-proxy/service-proxies';
import { AppComponentBase } from '@shared/common/app-component-base';

@Component({
  selector: 'app-product-detail-modal',
  templateUrl: './product-detail-modal.component.html',
  styleUrls: ['./product-detail-modal.component.less']
})
export class ProductDetailModalComponent extends AppComponentBase implements OnInit {
  isVisible: boolean = false;
  product:ProductInfoDTO;
  constructor(
    injector: Injector,
    private _service: ServiceProxy) {
      super(injector);
  }

  ngOnInit() {
    this.product = new ProductInfoDTO();
  }

  show(id:string){
    this.isVisible =true;
    this.getProduct(id);
  }

  getProduct(id:string){
    this._service.searchProductInfoByContainerIdUsingGET(id).subscribe(result=>{
      this.product = result.result;
    })
  }

  handleCancel() {
    this.isVisible = false;
  }

  handleOk() {
    this.isVisible = false;
  }
}
